package com.rose.springbootmoredatasourcejpa;

import com.rose.springbootmoredatasourcejpa.config.DynamicDataSourceAnnotationAdvisor;
import com.rose.springbootmoredatasourcejpa.config.DynamicDataSourceAnnotationInterceptor;
import com.rose.springbootmoredatasourcejpa.config.DynamicDataSourceRegister;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@SpringBootApplication
@Import(DynamicDataSourceRegister.class)
@EnableTransactionManagement
public class SpringbootMoreDatasourceJpaApplication {
        @Bean
    public DynamicDataSourceAnnotationAdvisor dynamicDatasourceAnnotationAdvisor() {
        return new DynamicDataSourceAnnotationAdvisor(new DynamicDataSourceAnnotationInterceptor());
    }
    public static void main(String[] args) {
        SpringApplication.run(SpringbootMoreDatasourceJpaApplication.class, args);
    }
}
